package belka.us.ohostoggleswitch.util;
import belka.us.ohostoggleswitch.ResourceTable;
import ohos.agp.components.Component;
import ohos.agp.components.LayoutScatter;
import ohos.agp.components.Text;
import ohos.app.Context;

/**
 * Created by lorenzorigato on 4/1/16.
 */
public class ToggleSwitchButton{

    private Component view;
    private Text textView;
    private Component separator;

    public ToggleSwitchButton(Context context) {
//        LayoutInflater.from(context).inflate(R.layout.item_widget_toggle_switch, null)
        this(LayoutScatter.getInstance(context).parse(ResourceTable.Layout_item_widget_toggle_switch,null,false));
    }

    public ToggleSwitchButton(Component view) {
        this.view = view;
        this.textView = (Text) view.findComponentById(ResourceTable.Id_text_view);
        this.separator = view.findComponentById(ResourceTable.Id_separator);
    }

    public Component getView() {
        return view;
    }

    public Text getTextView() {
        return textView;
    }

    public Component getSeparator() {
        return separator;
    }

    public void showSeparator(){
        getSeparator().setVisibility(Component.VISIBLE);
    }

    public void hideSeparator(){
        getSeparator().setVisibility(Component.INVISIBLE);
    }
}
